/*
 * ChatApp.java
 */

package chat.client;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;
import java.awt.event.*;

/**
 * The main class of the application.
 */
public class ChatApp extends SingleFrameApplication implements WindowListener, WindowFocusListener,
        WindowStateListener  {
       private ChatView cv;
    /**
     * At startup create and show the main frame of the application.
     */
    @Override protected void startup() {
       // getMainFrame().setTitle("ddfmeApp");
        cv = new ChatView(this);
        show(cv);
    }

    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     */
    @Override protected void configureWindow(java.awt.Window root) {
        root.addWindowListener(this);
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of ChatApp
     */
    public static ChatApp getApplication() {
        return Application.getInstance(ChatApp.class);
    }

    /**
     * Main method launching the application.
     */
    public static void main(String[] args) {
        launch(ChatApp.class, args);
    }

    public void windowClosed(WindowEvent e) {
    }

    public void windowClosing(WindowEvent e) {
        cv.closeApplication();
    }

    public void windowOpened(WindowEvent e) {
    }

    public void windowIconified(WindowEvent e) {
    }

    public void windowDeiconified(WindowEvent e) {
    }

    public void windowActivated(WindowEvent e) {
    }

    public void windowDeactivated(WindowEvent e) {
    }

    public void windowGainedFocus(WindowEvent e) {
    }

    public void windowLostFocus(WindowEvent e) {
    }

    public void windowStateChanged(WindowEvent e) {
       // cv.resetTabSize();
    }

}
